package com.mec.fileTransfer.core;

import java.net.Socket;
import java.util.List;

public class ResourceSenderCenter {
	private String receiverIp;
	private int receiverPort;
	private Socket socket;
	private ReceiveFileSet sendFileSet;
	private List<SendFileModel> sendFileList;
	
	public ResourceSenderCenter(String receiverIp, int receiverPort) {
		this.receiverIp = receiverIp;
		this.receiverPort = receiverPort;
	}
	
	public void setSendFileSet(ReceiveFileSet sendFileSet) {
		this.sendFileSet = sendFileSet;
	}

	public void setSendFileList(List<SendFileModel> sendFileList) {
		this.sendFileList = sendFileList;
	}

	public void startSendding() throws Exception {
		if (sendFileSet == null || sendFileList == null) {
			System.out.println("请先初始化发送文件列表！！");
			return;
		}
		socket = new Socket(receiverIp, receiverPort);
		System.out.println("receive server ip an port:" + receiverIp + receiverPort);
		new ResourceSender(socket, sendFileSet, sendFileList);
	}
}
